-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nix flake respect unused grammars #9326
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than except
, only
is also possible and I think we should have grammars.nix
respect it even if we don't currently use it in languages.toml
: https://docs.helix-editor.com/languages.html#choosing-grammars
Here's where we do it in the source:
helix/helix-loader/src/grammar.rs
Lines 208 to 220 in 17dd102
let grammars = match config.grammar_selection { | |
Some(GrammarSelection::Only { only: selections }) => config | |
.grammar | |
.into_iter() | |
.filter(|grammar| selections.contains(&grammar.grammar_id)) | |
.collect(), | |
Some(GrammarSelection::Except { except: rejections }) => config | |
.grammar | |
.into_iter() | |
.filter(|grammar| !rejections.contains(&grammar.grammar_id)) | |
.collect(), | |
None => config.grammar, | |
}; |
I believe if both only
and except
are defined then we prefer only
(ignoring except
).
Thanks for the heads-up, will refactor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* Make nix flake respect unused grammars * Use default value * Refactor * Take use-grammars.only into account --------- Co-authored-by: Sebastian Zivota <[email protected]>
* Make nix flake respect unused grammars * Use default value * Refactor * Take use-grammars.only into account --------- Co-authored-by: Sebastian Zivota <[email protected]>
* Make nix flake respect unused grammars * Use default value * Refactor * Take use-grammars.only into account --------- Co-authored-by: Sebastian Zivota <[email protected]>
* Make nix flake respect unused grammars * Use default value * Refactor * Take use-grammars.only into account --------- Co-authored-by: Sebastian Zivota <[email protected]>
* Make nix flake respect unused grammars * Use default value * Refactor * Take use-grammars.only into account --------- Co-authored-by: Sebastian Zivota <[email protected]>
17dd102 marked some grammars as "do not use", but the nix flake doesn't respect this setting. This is my attempt to rectify this situation.